package org.loofer.user.data.respository

import org.loofer.base.data.net.RetrofitFactory
import org.loofer.base.data.protocol.BaseResp
import org.loofer.user.data.api.UserApi
import org.loofer.user.data.protocol.*
import rx.Observable
import javax.inject.Inject

/**
 *============================================================
 * 版权： Loofer 版权所有（c）2018
 *
 * 作者：Loofer
 * 版本：1.0
 * 创建日期 ：2018/7/1 15:45.
 * 描述：用户相关数据层
 *
 * 注:如果您修改了本类请填写以下内容作为记录，如非本人操作劳烦通知，谢谢！！！
 * Modified Date Modify Content:
 *
 *==========================================================
 */
class UserRepository @Inject constructor() {

    /*
       用户注册
    */
    fun register(mobile: String, pwd: String, verifyCode: String): Observable<BaseResp<String>> {
//        return RetrofitFactory.instance.create(UserApi::class.java).register(RegisterReq(mobile, pwd, verifyCode))
        return Observable.just(BaseResp(0,"注册成功","成功data"))
    }

    /*
        用户登录
     */
    fun login(mobile: String, pwd: String, pushId: String): Observable<BaseResp<UserInfo>> {
//        return RetrofitFactory.instance.create(UserApi::class.java).login(LoginReq(mobile, pwd, pushId))
        return Observable.just(BaseResp(0,"成功",UserInfo("1","","张三","usergender",
                "132456789","userSign")))
    }

    /*
        忘记密码
     */
    fun forgetPwd(mobile: String, verifyCode: String): Observable<BaseResp<String>> {
        return RetrofitFactory.instance.create(UserApi::class.java).forgetPwd(ForgetPwdReq(mobile, verifyCode))
    }

    /*
        重置密码
     */
    fun resetPwd(mobile: String, pwd: String): Observable<BaseResp<String>> {
        return RetrofitFactory.instance.create(UserApi::class.java).resetPwd(ResetPwdReq(mobile, pwd))
    }

    /*
        编辑用户资料
     */
    fun editUser(userIcon: String, userName: String, userGender: String, userSign: String): Observable<BaseResp<UserInfo>> {
        return RetrofitFactory.instance.create(UserApi::class.java).editUser(EditUserReq(userIcon, userName, userGender, userSign))
    }


}